from flask import Flask
from flask_sqlalchemy import SQLAlchemy
from flask_session  import Session
from info.modules.index import index_blue
db = SQLAlchemy()


def create_app(config_name):

    app = Flask(__name__)
    app.config.from_object(config_name)
    app.register_blueprint(index_blue)
    db.init_app(app)  # 实例数据库绑定ａｐｐ
    Session(app)  # 初始化session,并和ａｐｐ实例关联

    return app